package com.dlc.shop.systemtest.api.common;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dlc.shop.bean.model.HotSearch;
import com.dlc.shop.common.util.Json;
import com.dlc.shop.systemtest.util.HttpUtil;

import java.util.List;

/**
 * @author Tu
 */
public class HotSearchApi {
    public static void save(String url,HotSearch hotSearch){
        HttpUtil.post(url,hotSearch);
    }

    public static List<HotSearch> listHotSearch(String url){
        return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, Page.class)), Page.class).getRecords()), HotSearch.class);
    }
    public static HotSearch info(String url){
        return HttpUtil.get(url,HotSearch.class);
    }

    public static void delete(String url,List<Long> ids){
        HttpUtil.delete(url,ids);
    }

    public static void update(String url,HotSearch hotSearch){
        HttpUtil.put(url,hotSearch);
    }
}
